{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "898a8ebc",
   "metadata": {},
   "source": [
    "# 欢迎来到notebook_hub\n",
    "\n",
    "由于作者不习惯官方镜像jupyterlab的使用，所以基于ubuntu的基础镜像制作了这个jupyter notebook的docker镜像。\n",
    "\n",
    "该镜像整合了python3，R语言，Nbextensions等插件并对jupyter notebook进行了优化处理。\n",
    "\n",
    "github项目地址：https://github.com/brokyz/jupyter_notebook_for_docker\n",
    "\n",
    "dockerhub项目地址：https://registry.hub.docker.com/r/brokyz/notebook_hub\n",
    "\n",
    "## 优化内容\n",
    "- 优化jupyter notebook的UI显示。\n",
    "- 优化jupyter notebook对中文的支持。\n",
    "- 优化了部分包对中文字体的显示乱码问题。\n",
    "- 为jupyter notebook添加了Nbextensions功能增强插件。\n",
    "- 为jupyter notebook整合了python3和R的内核支持。\n",
    "\n",
    "## 搭建\n",
    "\n",
    "### 拉取镜像\n",
    "```\n",
    "docker pull brokyz/notebook_hub\n",
    "```\n",
    "### 部署镜像\n",
    "```\n",
    "docker run -d -p 8889:8888 --name=notebook_hub --restart=always brokyz/notebook_hub\n",
    "# 如果存在端口冲突，请修改端口。比如想要通过ip:9999访问，则需要改成-p 9999:8888\n",
    "```\n",
    "### 登录并查看镜像部署日志获取token\n",
    "```\n",
    "docker logs notebook_hub\n",
    "# 结果如下，token为1294c0bfc1513e9f2250df2ad52d40eb40b1ab678341e563\n",
    "--------------------------------------------------------------------------------------------------------------------------------------------------\n",
    "    To access the notebook, open this file in a browser:\n",
    "        file:///root/.local/share/jupyter/runtime/nbserver-8-open.html\n",
    "    Or copy and paste one of these URLs:\n",
    "        http://b1c5c1eb1901:8888/?token=1294c0bfc1513e9f2250df2ad52d40eb40b1ab678341e563\n",
    "     or http://127.0.0.1:8888/?token=1294c0bfc1513e9f2250df2ad52d40eb40b1ab678341e563\n",
    "```\n",
    "在浏览器输入 本机ip:8889 \n",
    "\n",
    "输入获得的token，并设置自己的登陆密码\n",
    "\n",
    "登陆密码设置后，需要重启容器才可以生效\n",
    "```\n",
    "docker restart notebook_hub\n",
    "```\n",
    "之后仅需要通过 ip:8887 就可以访问了\n",
    "\n",
    "## 使用\n",
    "\n",
    "### 相关信息\n",
    "- jupyter notebook的相关配置文件位于`/root/.jupyter`目录\n",
    "- jupyter notebook的工作目录位于`/root/notebook`目录\n",
    "\n",
    "### 修改工作目录\n",
    "\n",
    "修改配置文件/root/.jupyter/jupyter_notebook_config.py工作目录配置\n",
    "```\n",
    "c.NotebookApp.notebook_dir = '/root/notebook'\n",
    "```\n",
    "### 安装python包\n",
    "\n",
    "在jupyter notebook中，可以在notebook的代码块中运行以下命令安装python包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9bdd786d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (1.22.3)\n",
      "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (1.4.2)\n",
      "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (3.5.1)\n",
      "Requirement already satisfied: yapf in /usr/local/lib/python3.10/dist-packages (0.32.0)\n",
      "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas) (2022.1)\n",
      "Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas) (2.8.2)\n",
      "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib) (4.33.3)\n",
      "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib) (0.11.0)\n",
      "Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib) (9.1.0)\n",
      "Requirement already satisfied: pyparsing>=2.2.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib) (3.0.8)\n",
      "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib) (1.4.2)\n",
      "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib) (21.3)\n",
      "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m"
     ]
    }
   ],
   "source": [
    "!pip install numpy pandas matplotlib yapf"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "da692da7",
   "metadata": {},
   "source": [
    "在终端下直接使用`pip`安装即可\n",
    "\n",
    "### 安装R包\n",
    "\n",
    "在jupyter notebook中，可以在r内核的notebook的代码块中运行以下命令安装R包\n",
    "```\n",
    "install.packages('formatR')\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f30ba2c4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "During startup - Warning messages:\n",
      "1: Setting LC_COLLATE failed, using \"C\" \n",
      "2: Setting LC_TIME failed, using \"C\" \n",
      "3: Setting LC_MESSAGES failed, using \"C\" \n",
      "4: Setting LC_MONETARY failed, using \"C\" \n",
      "5: Setting LC_PAPER failed, using \"C\" \n",
      "6: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "Installing packages into ‘/usr/local/lib/R/site-library’\n",
      "(as ‘lib’ is unspecified)\n",
      "trying URL 'https://cloud.r-project.org/src/contrib/formatR_1.12.tar.gz'\n",
      "Content type 'application/x-gzip' length 95944 bytes (93 KB)\n",
      "==================================================\n",
      "downloaded 93 KB\n",
      "\n",
      "trying URL 'https://cloud.r-project.org/src/contrib/jsonlite_1.8.0.tar.gz'\n",
      "Content type 'application/x-gzip' length 1051625 bytes (1.0 MB)\n",
      "==================================================\n",
      "downloaded 1.0 MB\n",
      "\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "* installing *source* package ‘formatR’ ...\n",
      "** package ‘formatR’ successfully unpacked and MD5 sums checked\n",
      "** using staged installation\n",
      "** R\n",
      "** inst\n",
      "** byte-compile and prepare package for lazy loading\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** help\n",
      "*** installing help indices\n",
      "** building package indices\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** installing vignettes\n",
      "** testing if installed package can be loaded from temporary location\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** testing if installed package can be loaded from final location\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** testing if installed package keeps a record of temporary installation path\n",
      "* DONE (formatR)\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "* installing *source* package ‘jsonlite’ ...\n",
      "** package ‘jsonlite’ successfully unpacked and MD5 sums checked\n",
      "** using staged installation\n",
      "** libs\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c base64.c -o base64.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c collapse_array.c -o collapse_array.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c collapse_object.c -o collapse_object.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c collapse_pretty.c -o collapse_pretty.o\n",
      "\u001b[01m\u001b[Kcollapse_pretty.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[KC_collapse_array_pretty_inner\u001b[m\u001b[K’:\n",
      "\u001b[01m\u001b[Kcollapse_pretty.c:99:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kargument 1 range [18446744071562067971, 18446744073709551615] exceeds maximum object size 9223372036854775807 [\u001b[01;35m\u001b[K\u001b]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size-larger-than=\u0007-Walloc-size-larger-than=\u001b]8;;\u0007\u001b[m\u001b[K]\n",
      "   99 |   char *str = \u001b[01;35m\u001b[Kmalloc(nchar_total)\u001b[m\u001b[K;\n",
      "      |               \u001b[01;35m\u001b[K^~~~~~~~~~~~~~~~~~~\u001b[m\u001b[K\n",
      "In file included from \u001b[01m\u001b[Kcollapse_pretty.c:3\u001b[m\u001b[K:\n",
      "\u001b[01m\u001b[K/usr/include/stdlib.h:540:14:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kin a call to allocation function ‘\u001b[01m\u001b[Kmalloc\u001b[m\u001b[K’ declared here\n",
      "  540 | extern void *\u001b[01;36m\u001b[Kmalloc\u001b[m\u001b[K (size_t __size) __THROW __attribute_malloc__\n",
      "      |              \u001b[01;36m\u001b[K^~~~~~\u001b[m\u001b[K\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c escape_chars.c -o escape_chars.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c integer64_to_na.c -o integer64_to_na.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c is_datelist.c -o is_datelist.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c is_recordlist.c -o is_recordlist.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c is_scalarlist.c -o is_scalarlist.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c modp_numtoa.c -o modp_numtoa.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c null_to_na.c -o null_to_na.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c num_to_char.c -o num_to_char.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c parse.c -o parse.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c prettify.c -o prettify.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c push_parser.c -o push_parser.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c r-base64.c -o r-base64.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c register.c -o register.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c row_collapse.c -o row_collapse.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c transpose_list.c -o transpose_list.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c validate.c -o validate.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl.c -o yajl/yajl.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_alloc.c -o yajl/yajl_alloc.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_buf.c -o yajl/yajl_buf.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_encode.c -o yajl/yajl_encode.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_gen.c -o yajl/yajl_gen.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_lex.c -o yajl/yajl_lex.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_parser.c -o yajl/yajl_parser.o\n",
      "gcc -I\"/usr/share/R/include\" -DNDEBUG -Iyajl/api    -fvisibility=hidden  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-4A2Reg/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c yajl/yajl_tree.c -o yajl/yajl_tree.o\n",
      "ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o\n",
      "gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o jsonlite.so base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -L/usr/lib/R/lib -lR\n",
      "installing to /usr/local/lib/R/site-library/00LOCK-jsonlite/00new/jsonlite/libs\n",
      "** R\n",
      "** inst\n",
      "** byte-compile and prepare package for lazy loading\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "in method for ‘asJSON’ with signature ‘\"AsIs\"’: no definition for class “AsIs”\n",
      "in method for ‘asJSON’ with signature ‘\"ITime\"’: no definition for class “ITime”\n",
      "in method for ‘asJSON’ with signature ‘\"hms\"’: no definition for class “hms”\n",
      "in method for ‘asJSON’ with signature ‘\"json\"’: no definition for class “json”\n",
      "in method for ‘asJSON’ with signature ‘\"integer64\"’: no definition for class “integer64”\n",
      "in method for ‘asJSON’ with signature ‘\"pairlist\"’: no definition for class “pairlist”\n",
      "in method for ‘asJSON’ with signature ‘\"blob\"’: no definition for class “blob”\n",
      "in method for ‘asJSON’ with signature ‘\"scalar\"’: no definition for class “scalar”\n",
      "in method for ‘asJSON’ with signature ‘\"sf\"’: no definition for class “sf”\n",
      "in method for ‘asJSON’ with signature ‘\"sfc\"’: no definition for class “sfc”\n",
      "** help\n",
      "*** installing help indices\n",
      "** building package indices\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** installing vignettes\n",
      "** testing if installed package can be loaded from temporary location\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** checking absolute paths in shared objects and dynamic libraries\n",
      "** testing if installed package can be loaded from final location\n",
      "During startup - Warning messages:\n",
      "1: Setting LC_TIME failed, using \"C\" \n",
      "2: Setting LC_MESSAGES failed, using \"C\" \n",
      "3: Setting LC_MONETARY failed, using \"C\" \n",
      "4: Setting LC_PAPER failed, using \"C\" \n",
      "5: Setting LC_MEASUREMENT failed, using \"C\" \n",
      "** testing if installed package keeps a record of temporary installation path\n",
      "* DONE (jsonlite)\n",
      "\n",
      "The downloaded source packages are in\n",
      "\t‘/tmp/RtmpwaOQAS/downloaded_packages’\n"
     ]
    }
   ],
   "source": [
    "!Rscript -e \"install.packages(c('formatR', 'jsonlite'))\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "463125c7",
   "metadata": {},
   "source": [
    "在终端中可以使用以下代码安装R包\n",
    "```\n",
    "Rscript -e \"install.packages('formatR')\"\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "efaae72f",
   "metadata": {},
   "source": [
    "\n",
    "### 修改相关字体大小，行间距等UI信息\n",
    "\n",
    "修改用户自定义css文件/root/.jupyter/custom/custom.css\n",
    "\n",
    "默认优化后的配置为\n",
    "```\n",
    "/* Body */\n",
    "/* #notebook-container {\n",
    "    width: 90%\n",
    "} */\n",
    "\n",
    "/* Markdown */\n",
    "div#notebook {\n",
    "    font-family: san francisco, \"PingFangSC-Medium\", \"Microsoft YaHei\";\n",
    "    line-height: 20px;\n",
    "    -webkit-font-smoothing: antialiased !important;\n",
    "}\n",
    "\n",
    "/* Markdown - h2 */\n",
    "div#notebook h2 {\n",
    "    color: #007aff;\n",
    "}\n",
    "\n",
    "/* Markdown - quote */\n",
    "div#notebook blockquote{\n",
    "    background-color: #f8f8f8;\n",
    "    color: #505050;\n",
    "    padding: 8.5px;\n",
    "    margin: 0.5em -0.5em 0.5em -0.4em;\n",
    "}\n",
    "\n",
    "/* Markdown - code in paragraph */\n",
    "div#notebook p code, div#notebook li code {\n",
    "    font-family: Consolas, \"PingFangSC-Medium\", \"Microsoft YaHei\";\n",
    "    font-size: 1em !important;\n",
    "    color: #111111;\n",
    "    border: 0.5px solid #cfcfcf;\n",
    "    border-radius: 2px;\n",
    "    background-color: #f7f7f7;\n",
    "    padding: .1em .2em;\n",
    "    margin: 0px 2px;\n",
    "}\n",
    "\n",
    "/* Markdown - code */\n",
    "div.text_cell_render pre {\n",
    "    border: 1px solid #cfcfcf;\n",
    "    border-radius: 2px;\n",
    "    background: #f7f7f7;\n",
    "    line-height: 1.21429em;\n",
    "    padding: 8.5px;\n",
    "    margin: 0.5em -0.5em 0.5em -0.4em;\n",
    "}\n",
    "div.text_cell_render code {\n",
    "    background: #f7f7f7;\n",
    "}\n",
    "\n",
    "/* Code */\n",
    "div.CodeMirror-code {\n",
    "    font-family: Consolas, \"PingFangSC-Medium\", \"Microsoft YaHei\";\n",
    "    font-size: 11pt;\n",
    "    line-height: 140%;\n",
    "    -webkit-font-smoothing: antialiased !important;\n",
    "}\n",
    "\n",
    "/* Code - output */\n",
    "div.output pre {\n",
    "    font-family: Consolas, \"PingFangSC-Medium\", \"Microsoft YaHei\";\n",
    "    line-height: 20px;\n",
    "    -webkit-font-smoothing: antialiased !important;\n",
    "}\n",
    "\n",
    "/* Code - comment */\n",
    "span.cm-comment {\n",
    "    font-family: san francisco, \"PingFangSC-Medium\", \"Microsoft YaHei\" !important;\n",
    "    font-style: normal !important;\n",
    "}\n",
    "```\n",
    "\n",
    "### 添加matplotlib显示字体\n",
    "\n",
    "这里自带了`SimHei`字体，可以使用以下代码来添加SimHei字体\n",
    "```\n",
    "import matplotlib.pyplot as plt\n",
    "plt.rcParams['font.family']=['SimHei']\n",
    "plt.rcParams['axes.unicode_minus']=False\n",
    "```\n",
    "如果需要其他字体，需要将字体包移动到`/usr/share/fonts`目录下，重启docker容器后生效"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "a6bf2dfe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAlIAAAE9CAYAAADAlYxhAAAAOXRFWHRTb2Z0d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1KsyyXJH+E+X4tL75fy4vv1/Li+7WfLXmxuSRJkhbnnc0lSZIaGaRGkGR1kk9Pug8tLT0fTXJTkquSDPtUqiYoyUySK5PckOTDk+5Ho0nytiSfm3QfWlqSlyXZkeSL3eOESfe0UhmkhkhyELAd79i+HJwKzFTVycDBPPZpUk2nfwXcVlWnAkcleeFk29EwSY4FLph0HxrZH1TVad1jOd27cVkxSA1RVQ9W1QuAHZPuRUPdA1zajR+aZCMayV8Cv9PNHD4DeGCy7WgElwIXT7oJjezVSW5O8t/9O7j7j0FKK0ZVfbOqbk7yKuAA4JpJ96TFVdX3q+qHwA3APVX1rUn3pMUlOQ+4DfjGpHvRSO4CfrOqfho4Cvi5CfezYhmktKIkOQd4C3B2VT0y6X60uCSHJTkQOAU4JIl/p3O6nQW8FPgYsC7Jmybcj5Z2H7DnWra7gSMm18rKZpDSipHkSOAi4BVV9b1J96Oh3g68pgu8PwQOmnA/WkJVnVdVpwHnAtur6gOT7klL+vfAuUlWAc8Hvj7hflYsg5RWktfTm8K+pvuUyhsm3ZCWdBnwhiQ3AvfiUqw0Th8Afhn4MvDJqnJJdj/xhpySJEmNnJGSJElqZJCSJElqZJCSJElqZJCSJElqZJCSJElqZJCSJElqZJCSJElq9P8Bpa3aVdJeny8AAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "plt.rcParams['font.family']=['SimHei']\n",
    "plt.rcParams['axes.unicode_minus']=False\n",
    "plt.figure(figsize=(10, 5))\n",
    "x = np.arange(1, 6)\n",
    "Y1 = np.random.uniform(1.5, 1.0, 5)\n",
    "Y2 = np.random.uniform(1.5, 1.0, 5)\n",
    "plt.bar(x, Y1, width=0.35, facecolor='lightskyblue', edgecolor='white')\n",
    "plt.bar(x + 0.35, Y2, width=0.35, facecolor='yellowgreen', edgecolor='white')\n",
    "plt.title('测试matplotlib的中文输出')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "hide_input": false,
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  },
  "nbTranslate": {
   "displayLangs": [
    "*"
   ],
   "hotkey": "alt-t",
   "langInMainMenu": true,
   "sourceLang": "en",
   "targetLang": "fr",
   "useGoogleTranslate": true
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
